import { Component } from 'react';
import { connect } from 'dva';
import Authorized from '@/utils/Authorized';

const { Secured } = Authorized;
// use permission as a parameter
const havePermissionAsync = new Promise(resolve => {
  // Call resolve on behalf of passed
  setTimeout(() => resolve(), 300);
});

@Secured(havePermissionAsync)
@connect(({ monitor, loading }) => ({
  monitor,
  loading: loading.models.monitor,
}))
class BlankJump extends Component {
  componentDidMount() {
    const token = encodeURIComponent(localStorage.getItem('token'));
    const username = encodeURIComponent(localStorage.getItem('username'));
    const url = `http://luopan.caicaivip.com?token=${token}&username=${username}`;
    window.open(url);
  }

  render() {
    return '';
  }
}

export default BlankJump;
